package me.minicoral.dao.impl;

import java.sql.SQLException;

import org.apache.commons.dbutils.QueryRunner;

import me.minicoral.action.Friends;
import me.minicoral.dao.FriendsDao;
import me.minicoral.exception.DaoException;
import me.minicoral.util.DBCPUtil;

public class FriendsDaoImpl implements FriendsDao
{
	private QueryRunner qr = new QueryRunner(DBCPUtil.getDataSource());
	@Override
	public int addFriend(Friends friends)
	{
		try
		{
			String sql = "insert into tfriends values(?,?,?)";
			Object param[] = {friends.getFid(),friends.getFuuid(),friends.getCuuid()};
			return qr.update(sql, param);
		}
		catch (SQLException e)
		{
			throw new DaoException();
		}
	}

}
